<?php

class admin_controller_admin_user extends AdminController {
	/**
	 * @name 增加用户表单
	 *
	 */
	public function add_form_action(){
		
	}
	
	/**
	 * @name 增加用户
	 *
	 */
	public function add_action(){
		$uid = _('uid');
		$username = $this->SL->soap_query_info($uid, '', 'nickname');
		if($username){
			$user = Model::factory("admin_model_user");
			$flag = $user->insert($uid, $username);
		}
		$this->ret = self::success(array('message'=>($flag?"添加用户成功":"添加用户失败")));
		$this->_renderJSJump();
	}
	
	/**
	 * @name 用户列表
	 *
	 */
	public function list_action(){
		$user = Model::factory("admin_model_user");
		$this->ret = self::success($user->selectList());
	}
	
	/**
	 * @name 删除用户
	 *
	 */
	public function delete_action(){
		$user = Model::factory("admin_model_user");
		if($flag = $user->remove($this->uid)){
			$this->ret = self::success();
		}else{
			$this->ret = self::failure("删除失败");
		}
//		$this->ret = self::success(array('message'=>($flag?"用户已删除":"删除失败")));
		$this->_renderJSJump();
	}
	
	/**
	 * @name 没有权限操作
	 * @ignore 
	 *
	 */
	public function no_priv_action(){

	}
	
	
}